package nccloud.web.hrpbctp.busictrl.busictrl.action;

import nc.vo.bd.util.ArrayUtil;
import nc.vo.hrpbctp.busictrl.AggBusiCtrlVO;
import nc.vo.hrpbctp.busictrl.BusiCtrlDataVO;
import nc.vo.pub.lang.UFDouble;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wangyong
 * @Date 2025年10月16日
 * @过滤预算执行监控中执行情况为零的数据
 * 
 */
public class FilterDataUtil {

    /**
     * 过滤预算执行监控中   执行情况为零的
     *  <p>过滤  批复数、调整数、年度预算数、执行数、预占数、可用数 都为零的</p>
     * @param aggvo
     * @return
     */
    public static AggBusiCtrlVO filterAggBusiCtrlVOValueZero(AggBusiCtrlVO aggvo){
        BusiCtrlDataVO[] bvos = (BusiCtrlDataVO[])aggvo.getChildren(BusiCtrlDataVO.class);
        List<BusiCtrlDataVO> lbvos = new ArrayList<>();
        if(bvos != null || ArrayUtil.isEmpty(bvos)){
            for (BusiCtrlDataVO bvo : bvos) {
                UFDouble adjustamount = bvo.getAdjustamount(); // 调整数
                UFDouble controlamount = bvo.getControlamount(); // 年度预算数
//                UFDouble freezeamount = bvo.getFreezeamount(); // 冻结数
                UFDouble preoccuamount = bvo.getPreoccuamount(); // 预占数
                UFDouble balance = bvo.getBalance();  // 可用预算数

                if (adjustamount.getDouble() != new Double(0)
                        || controlamount.getDouble() != new Double(0)
//                        || freezeamount.getDouble() != new Double(0)
                        || preoccuamount.getDouble() != new Double(0)
                        || balance.getDouble() != new Double(0)
                ){
                    lbvos.add(bvo);
                }

            }
        }
        aggvo.setChildren(BusiCtrlDataVO.class, lbvos.toArray(new BusiCtrlDataVO[0]));
        return aggvo;
    }

}
